package com.yunsuo.service;

import java.io.IOException;

public class LockService {
    public  static void openDoor(){
        Process ps = null;
        //System.out.println("调用开门的python代码++++++++++++++++++");
        //System.out.println("open.py");
        try {
            ps = Runtime.getRuntime().exec("python3 "+ "/home/pi/openDoor/open.py");
        } catch (IOException e) {
            e.printStackTrace();
        }
        int status1 = 0;//返回0为成功
        try {
            status1 = ps.waitFor();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //System.out.println(status1);
        //System.out.println("开门成功");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //System.out.println("开门后2秒延时结束");
    }
}
